import config from 'config'
import httpFetch from 'share/httpFetch'

export default {
  // 获取code
  getVendorCode(params){
    params.companyType = '1002';
    return httpFetch.post(`/vendor-data-service/api/order/invoicePushConfig/search`, params);
  },
  // 添加和取消标记
  addAndSubRemark(params){
    params.companyType = '1002';
    return httpFetch.post(`/vendor-data-service/api/order/reconciliation/opinion`, params);
  },
  //对账预览信息
  getTotalSummary(params){
    params.companyType = '1002';
    return httpFetch.post(`${config.baseUrl}/report/api/order/settlement/totalSummary`,params)
  },

  //查询
  getPlaneBill(params,type){
    params.companyType = '1002';
    return httpFetch.post(`${config.baseUrl}/report/api/order/${type}/reconciliation/search/v2`,params)
  },

  //供应商options
  getSuppliers(){
    return httpFetch.get(`${config.baseUrl}/api/function/profiles/company/sort/vendor`)
  },

  //确认账单
  confirmBill(params,type){
    params.companyType = '1002';
    return httpFetch.post(`${config.baseUrl}/vendor-data-service/api/order/${type}/reconciliation/confirm`,params)
  },

  //合计金额
  getAmount(params,type){
    params.companyType = '1002';
    return httpFetch.post(`${config.baseUrl}/report/api/order/${type}/reconciliation/search/amount`,params)
  },

  //下载账单
  download(params,type){
    params.companyType = '1002';
    return httpFetch.post(`${config.baseUrl}/report/api/order/reconciliation/export/${type}/v2`,params)
  },

  //线下核对
  checkOffLine(params, data){
    const header =  {
      "Content-type": 'multipart/form-data',
    }
    return httpFetch.post(`${config.baseUrl}/vendor-data-service/api/order/reconciliation/contrast?companyOID=${params.companyOID}`,data, header)
  },

  // 下载核对结果
  downloadResultFile(key){
    const data = {
      "channel":"hly-admin",
      ...key,
    }
    data.companyType = '1002';
    return httpFetch.post(`${config.baseUrl}/vendor-data-service/api/order/export/reconciliation/contrast`, data)
  },

  // 下载核对模板
  downloadTemplateFile(key){
    const data = {
      "channel":"hly-admin",
      ...key,
    }
    data.companyType = '1002';
    return httpFetch.post(`${config.baseUrl}/vendor-data-service/api/order/reconciliation/download/contrast/excel`, data)
  },

  // 查询对账结果
  requestCheckResult(params){
    params.companyType = '1002';
    return httpFetch.post(`${config.baseUrl}/vendor-data-service/api/order/query/reconciliation/contrast`,params);
  }

}
